import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 提现记录信息 */
export interface WithdrawRecord {
          id: number; // ID
          userId?: number; // 用户ID
          amount?: number; // 提现金额（单位分）
          status?: number; // 提现状态：[0待审核；1审核通过；2已到账；3审核拒绝；4提现失败]
          failCause: string; // 失败/拒绝原因
          doneTime: string | Dayjs; // 提现到账时间
          payTransferId: number; // 转账单编号
  }

// 提现记录 API
export const WithdrawRecordApi = {
  // 查询提现记录分页
  getWithdrawRecordPage: async (params: any) => {
    return await request.get({ url: `/business/withdraw-record/page`, params })
  },

  // 查询提现记录详情
  getWithdrawRecord: async (id: number) => {
    return await request.get({ url: `/business/withdraw-record/get?id=` + id })
  },

  // 新增提现记录
  createWithdrawRecord: async (data: WithdrawRecord) => {
    return await request.post({ url: `/business/withdraw-record/create`, data })
  },

  // 修改提现记录
  updateWithdrawRecord: async (data: WithdrawRecord) => {
    return await request.put({ url: `/business/withdraw-record/update`, data })
  },

  // 删除提现记录
  deleteWithdrawRecord: async (id: number) => {
    return await request.delete({ url: `/business/withdraw-record/delete?id=` + id })
  },

  /** 批量删除提现记录 */
  deleteWithdrawRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/business/withdraw-record/delete-list?ids=${ids.join(',')}` })
  },

  // 导出提现记录 Excel
  exportWithdrawRecord: async (params) => {
    return await request.download({ url: `/business/withdraw-record/export-excel`, params })
  },
}